package net.wanho.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class AjaxResult implements Serializable {

    private Integer status;
    private String msg;
    private Object data;

    public static AjaxResult success(Object data) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatus(200);
        ajaxResult.setMsg("success");
        ajaxResult.setData(data);
        return ajaxResult;
    }
    public static AjaxResult success() {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatus(200);
        ajaxResult.setMsg("success");
        return ajaxResult;
    }
    public static AjaxResult error(String msg) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatus(500);
        ajaxResult.setMsg(msg);
        return ajaxResult;
    }
    public static AjaxResult error(Integer status, String msg) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatus(status);
        ajaxResult.setMsg(msg);
        return ajaxResult;
    }
}
